Skip to content

Conversation

lxcid
Copy link
Contributor

@lxcid lxcid commented Feb 5, 2022

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Continuation from #70.

In v7, we can use this package in browser, but because of the 'node:url' import in v8, browser support is no longer available. The initial dismissal of the issue #70 was due to typescript complain, this PR attempt to address that in hope that it get merged and browser support is re-enabled again.

Changelog

  • Pinning TypeScript to v4.4.x as it is hanging the compiler, see tsc 4.5 hangs with unist-util-visit package (works fine with 4.4.4) microsoft/TypeScript#46900
  • Fix figure figcaption test case which is broken, somehow \ was added to the filename, but i checked the html there's no such character. Feel free to correct me if i'm wrong.
  • Remove import {URL} from 'node:url', from my use case, typescript didn't complain, but if it ever complain, my solution is to introduce DOM to libs in tsconfig.

@github-actions github-actions bot added the 👋 phase/new Post is being triaged automatically label Feb 5, 2022
@github-actions

This comment has been minimized.

@lxcid lxcid force-pushed the lxcid/remove-url-import branch from 50aaaf0 to 9f0d0e5 Compare February 5, 2022 09:25
@lxcid lxcid marked this pull request as ready for review February 5, 2022 09:34
@lxcid lxcid changed the title fix: Use global URL instead of importing from 'node:url' to enable browser support fix: Enable browser support by using URL in global namespace instead of importing from 'node:url' Feb 5, 2022
@wooorm
Copy link
Member

wooorm commented Feb 6, 2022

browser support is no longer available.

People are using this in browsers. #70 also mentions that this is likely a problem with your bundler that can be solved.

from my use case, typescript didn't complain,

You ran npm test after your change and nothing happened?

@lxcid
Copy link
Contributor Author

lxcid commented Feb 6, 2022

@wooorm yep! it pass for me. did it fail for you? The github action pass as well, i have to downgrade typescript to 4.4 and fix one broken test case though, otherwise everything is good.

Hmmm, did you make any configuration to ignore node:url when bundling? I'm using webpack/babel and is using fairly modern configuration though. I don't mind adjusting my webpack/babel configuration.

@wooorm
Copy link
Member

wooorm commented Feb 6, 2022

Ohh it’s been a years old issue with TypeScript, and they solved it 5 days ago: DefinitelyTyped/DefinitelyTyped#58277 (comment)

@github-actions github-actions bot added 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Feb 6, 2022
@wooorm wooorm changed the title fix: Enable browser support by using URL in global namespace instead of importing from 'node:url' Remove use of URL from node:url Feb 6, 2022
@wooorm wooorm merged commit 135288e into syntax-tree:main Feb 6, 2022
@github-actions

This comment has been minimized.

@wooorm wooorm added 🌐 platform/browser This affects browsers 🏗 area/tools This affects tooling 💪 phase/solved Post is done labels Feb 6, 2022
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Feb 6, 2022
@wooorm
Copy link
Member

wooorm commented Feb 6, 2022

Thanks, released!

@lxcid lxcid deleted the lxcid/remove-url-import branch February 7, 2022 03:10
@lxcid
Copy link
Contributor Author

lxcid commented Feb 7, 2022

thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏗 area/tools This affects tooling 💪 phase/solved Post is done 🌐 platform/browser This affects browsers
Development

Successfully merging this pull request may close these issues.

2 participants